﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.Model;
using HNQXYJ.BLL;

namespace HNQXYJ.HN_SysConfig
{
    public partial class HSysConfig : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SysConfig sc = new SysConfigBLL().ReturnSysConfig();
                this.txtIp.Text = sc.Ip;
                this.txtPort.Text = Convert.ToString(sc.Port);
            }
        }

        protected void add_Click(object sender, ImageClickEventArgs e)
        {
            SysConfig sc = new SysConfig();
            sc.Ip = this.txtIp.Text.Trim();
            sc.Port = Convert.ToInt32(this.txtPort.Text.Trim());

            bool flage = new SysConfigBLL().UpdateSysConfig(sc);
            if (flage)
            {
                this.Label1.Text = "更新成功！";
            }
            else
            {
                this.Label1.Text = "更新失败！";
            }


        }
    }
}